    
    public function {$actionName}($id)
    {
        // chequeo y obtengo el usuario loggeado
        $data['logueado'] = $this->getUsuarioLogueado();

        // valido permisos
        $gruposValidos = array();
        // ej. array('venta','logistica','contable','directivo');
        $this->validarPermisos($data['logueado'], $gruposValidos);

        // get object to edit
        $data['{$entity->singular}'] = new {$entity->singular|capitalize:true}($id);

        // Message Handler
        $data['msg'] = new PwMsgHandler();

        // prepare object attributes
        $this->updatePrepare($data);

        // if posting, try to save modifications
        if ($this->input->server('REQUEST_METHOD') === 'POST') {
            $this->{$actionName}_save($data);
        }

        // load view
        $this->smartyview->render('{$entity->singular}_{$actionName}.html', $data);

    } // function {$actionName}

    private function {$actionName}_save($data) 
    {
        // assignUpdatePost is defined on parent class and 
        // will assign all posting values to your attributes's class 
        // based on purposes definitions
        if ($this->assignUpdatePost($data)) {

            // You could customize attributes here

            // Saving Object and its relationships (feel free to edit)
            if ($this->saveEntity($data)) { 
            
                // post processing object attributes
                $this->afterUpdateSuccess($data);

                // Show success message in next view
                $data['msg']->success = '{$entity->singular} successfully updated';
                $data['msg']->persistSuccess();

                // redirects to edit
                redirect(base_url() . '{$entity->plural}/{$actionName}/' . $data['{$entity->singular}']->id . '/');
            }
            else { 
                // revert attributes changes if necesary
                $this->revertOnUpdateError($data);

                // Append model's errors
                $data['msg']->error .= $data['{$entity->singular}']->error->string;
            }
        } // if assignUpdatePost
    } // function {$actionName}_save